package net.tv90.bfmccore.listener.effect;

import org.bitterorange.flansmodslain.FlansModAPI;
import org.bukkit.entity.Player;

import java.util.List;

public class NeedSuppEffect extends RadioEffect{
    public NeedSuppEffect(String sound, String name) {
        super(sound, name);
    }

    @Override
    public void playEffectForPlayer(Player p, String country) {
        super.playEffectForPlayer(p, country);
        List<Integer> list = FlansModAPI.getNearByAiId(p.getWorld(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), 30);
        if(list != null && !list.isEmpty()) {
            for (Integer i : list) {
                if(FlansModAPI.isAiTeamer(p, i)){
                    FlansModAPI.setMoveTo(i, p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
                }
            }
            p.sendMessage("§a[队伍]已向友军" + list.size() + "个AI队友发送支援请求");
        }
    }
}
